package cn.edu.hizee.gps.dao;

import cn.edu.hizee.gps.model.ActionNode;
import cn.edu.hizee.gps.model.Unusual;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
 * @author ZX
 */
public interface UnusualRepository extends JpaRepository<Unusual,Integer> {
    //后面的泛型，前面为实体类，后面为实体类的ID类型。

    /**
     * 查看异常
     * @return
     */
    @Query(nativeQuery = true, value = "SELECT " +
            "t_unusual.user_id, " +
            "t_unusual.unusual_time, " +
            "t_user.phone, " +
            "t_user.real_name, " +
            "t_user.nickname " +
            "FROM " +
            "t_user " +
            "JOIN t_unusual on t_unusual.user_id = t_user.id ")
    List<Map> findAllUnusualAndUser();


}
